package com.example.maoyanmovie.ui.activity;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import com.example.maoyanmovie.databinding.ActivitySettingsBinding;
import com.example.maoyanmovie.utils.ToastUtils;

public class SettingsActivity extends AppCompatActivity {

    private ActivitySettingsBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivitySettingsBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        initView();
    }

    private void initView() {
        binding.ivBack.setOnClickListener(v -> finish());

        binding.switchNotification.setOnCheckedChangeListener((buttonView, isChecked) -> {
            ToastUtils.showShort(this, isChecked ? "已开启推送" : "已关闭推送");
        });

        binding.llClearCache.setOnClickListener(v -> {
            ToastUtils.showShort(this, "缓存已清除");
            binding.tvCacheSize.setText("0MB");
        });

        binding.llVersion.setOnClickListener(v -> {
            ToastUtils.showShort(this, "已是最新版本");
        });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        binding = null;
    }
}
